#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Create by Albert_Chen
# CopyRight (py) 2017年 陈超. All rights reserved by Chao.Chen.
# Create on 2017-01-19

from __future__ import absolute_import

from celery import Celery, platforms
from celery.schedules import crontab

platforms.C_FORCE_ROOT = True

broker_url = "amqp://guest:guest@localhost:5672//"
backend_url = "amqp://guest:guest@localhost:5672//"

app = Celery('schedule',
             broker=broker_url,
             backend=backend_url,
             include=['scheduler.tasks'])

app.conf.update(
    CELERY_TASK_SERIALIZER = 'json',
    CELERY_RESULT_SERIALIZER = 'json',
    CELERY_TIMEZONE= 'Asia/Shanghai',
    CELERY_TASK_RESULT_EXPIRES=3600,
    CELERYBEAT_SCHEDULE = {
        'every-9_30-am': {
            'task': 'report.send',
            'schedule': crontab(minute='30', hour='9'),
        },
    }
)

if __name__ == "__main__":
    app.start()
